package com.baizhi.controller;

import com.baizhi.entity.CmfzAlbum;
import com.baizhi.entity.CmfzAudio;
import com.baizhi.service.CmfzAudioService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2019/4/10 0010.
 */
@Controller
@RequestMapping("/audio")
public class CmfzAudioController {
    @Autowired
    private CmfzAudioService cmfzAudioService;


    @RequestMapping("/showAll")
    public @ResponseBody  List<CmfzAlbum> showAll(){
        List<CmfzAlbum> cmfzAlbums = cmfzAudioService.showAll();
        return cmfzAlbums;
    }

    @RequestMapping("/add")
    public @ResponseBody Map add(MultipartFile audio, CmfzAudio cmfzAudio, HttpServletRequest request){
        Map add = cmfzAudioService.add(audio, cmfzAudio, request);
        return add;
    }
}
